package com.rangter.MissedCalls.Utility;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class VoiceUtility {
	
	public static boolean getMp3FromServer(String urlStr,String fileName)
	{
		HttpURLConnection urlConn = null;  
        InputStream inputStream = null;  
        try {  
        	URL  url = new URL(urlStr);  
            urlConn = (HttpURLConnection)url.openConnection();  
            inputStream = urlConn.getInputStream();  
            FileUtils fileUtils = new FileUtils();
            File file = fileUtils.write2SDFromInput("voa/", fileName, inputStream);
            if(file == null)
            	return false;
            else
            	return true;
        } catch (MalformedURLException e) {  
            e.printStackTrace();  
            return false;
        } catch (IOException e) {  
            e.printStackTrace();  
            return false;
        }  
	}
	
	

}
